//
//  AddImageTextButtonCell.m
//  MIDI
//
//  Created by 邵子凡 on 15/10/29.
//  Copyright © 2015年 QXSX. All rights reserved.
//

#import "AddImageTextButtonCell.h"

@interface AddImageTextButtonCell ()

@property (weak, nonatomic) IBOutlet UIButton *cancel;
@property (weak, nonatomic) IBOutlet UIButton *apply;
@end

@implementation AddImageTextButtonCell

//通过xib加载主控件
+(instancetype)cellWithTableView:(UITableView *)tableView{
    
    static NSString *ID = @"AddImageTextButtonCell";
    AddImageTextButtonCell  *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle]loadNibNamed:@"AddImageTextButtonCell" owner:nil options:nil]firstObject] ;
        
    }
    
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    
    return cell;
}

- (void)awakeFromNib {
    
    //设置按钮圆角
    self.cancel.layer.cornerRadius = 8;
    self.apply.layer.cornerRadius = 8;
    //给申请按钮添加点击事件
    [self.apply addTarget:self action:@selector(apply_Click:) forControlEvents:UIControlEventTouchUpInside];
}

//申请按钮点击事件
- (void)apply_Click:(UIButton *)sender{
    
    if ([self.delegate respondsToSelector:@selector(uploadImageTextBtn:)]) {
        [self.delegate uploadImageTextBtn:self];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
